import { stringify } from 'qs';
import request from '../utils/request';

export async function queryChannels(params) {
  return request(`${location.origin}/jsons/taskChannel.json`);
}

export async function queryActivities(params) {
  return request(`${location.origin}/jsons/taskActivity.json`);
}

export async function queryShopName(params) {
  return request(`/api/spider/taobao/shopname?${stringify(params)}`);
}

export async function searchAuctions(params) {
  return request(`/api/auction/list/search?${stringify(params)}`);
}

export async function addAuction(params) {
  return request('/api/auction', {
    method: 'POST',
    body: {
      ...params,
    },
  });
}

export async function queryAuction(params) {
  return request(`/api/auction?${stringify(params)}`);
}

export async function queryScripts(params) {
  return request(`${location.origin}/jsons/taskScript.json`);
}
